﻿Imports IIC.Forms.Edit
Imports org.codegen.win.controls.Grid

Namespace Forms.List

    <Global.Microsoft.VisualBasic.CompilerServices.DesignerGenerated()> _
    Public Class frmStudentListBase
        Inherits frmBaseGrid

#Region "Designer"

        'Form overrides dispose to clean up the component list.
        <System.Diagnostics.DebuggerNonUserCode()> _
        Protected Overrides Sub Dispose(ByVal disposing As Boolean)
            Try
                If disposing AndAlso components IsNot Nothing Then
                    components.Dispose()
                End If
            Finally
                MyBase.Dispose(disposing)
            End Try
        End Sub

        Friend WithEvents UcListStudent As ucStudentList

        'Required by the Windows Form Designer
        Private components As System.ComponentModel.IContainer

        'NOTE: The following procedure is required by the Windows Form Designer
        'It can be modified using the Windows Form Designer.  
        'Do not modify it using the code editor.
        <System.Diagnostics.DebuggerStepThrough()> _
        Private Sub InitializeComponent()
            Me.UcListStudent = New IIC.ucStudentList()
            Me.pnlGrid.SuspendLayout()
            Me.SuspendLayout()
            '
            'pnlGrid
            '
            Me.pnlGrid.Controls.Add(Me.UcListStudent)
            Me.pnlGrid.Location = New System.Drawing.Point(0, 53)
            Me.pnlGrid.Size = New System.Drawing.Size(760, 389)
            '
            'UcListStudent
            '
            Me.UcListStudent.Dock = System.Windows.Forms.DockStyle.Fill
            Me.UcListStudent.Location = New System.Drawing.Point(0, 0)
            Me.UcListStudent.Name = "UcListStudent"
            Me.UcListStudent.Size = New System.Drawing.Size(760, 389)
            Me.UcListStudent.TabIndex = 0
            '
            'frmStudentList
            '
            Me.AutoScaleDimensions = New System.Drawing.SizeF(6.0!, 13.0!)
            Me.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font
            Me.ClientSize = New System.Drawing.Size(760, 442)
            Me.Name = "frmStudentList"
            Me.ShowExcelButton = True
            Me.ShowSearch = True
            Me.Text = "Student List"
            Me.Controls.SetChildIndex(Me.pnlGrid, 0)
            Me.pnlGrid.ResumeLayout(False)
            Me.ResumeLayout(False)

        End Sub

#End Region

#Region "Standard Code"


        ''' <summary>
        ''' This function is common to all forms that inherit from class frmBaseGrid
        ''' It priovides a common name to the underlying grid control that shows the records
        ''' </summary>
        Public Overrides Function grdData() As org.codegen.win.controls.Grid.CGBaseGrid
            Return Me.UcListStudent.grdStudent
        End Function

        Protected Sub DeleteRecordConfirmed(ByVal sender As System.Object) Handles Me.gridDeleteRecordConfirmed

            Dim m As New StudentDBMapper
            Dim gridsender As CGBaseGrid = CType(sender, CGBaseGrid)

            Dim mo As Student = m.findByKey(gridsender.IdValue)
            Call m.delete(mo)


        End Sub

#End Region

#Region "Custom Methods"

#End Region

        Private Sub frmStudentListBase_gridSearchExecuted() Handles Me.gridSearchExecuted

            If Me.UcListStudent.grdStudent.RowCount = 1 AndAlso Me.GridMode = enumGridFormMode.MODE_LIST Then

                If Not Me.cmdEdit.Enabled Then Return

                Call ListEditRecord(Me.grdData.IdValue)

            End If
        End Sub



    End Class

End Namespace

